$(function() {
	$("#header").load('header.html', function() {loadHeader(1)});
	$("#footer").load('footer.html', function(data, status, xhr) {});
	$("#tab").load('tab.html', function(data, status, xhr) {});
	//获取url中的参数
	function getUrlParam(name) {
		var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
		var r = window.location.search.substr(1).match(reg); //匹配目标参数
		if(r != null) return unescape(r[2]);
		return null; //返回参数值
	}
	//接收URL中的参数booksId
	var id = getUrlParam('mid');
	$.ajax({
		url: host + '/MtmlAPI/SucessCaseDetails',
		type: 'post',
		dataType: 'JSON',
		data: {
			cid: cid,
			id: id
		},
		success: function(res) {
			var obj = res.data
			if(res.state) {
				//								<li>
				//							<div class="casedetail-goods">所做商品:</div>
				//							<div class="casedetail-goods-msg">[玻尿酸]润百颜玻尿酸0.75ml</div>
				//							<div class="casedetail-goods-msg">单次</div>
				//						</li>
				$('.casedetail-main-l').append(
					`
					<div class='case-img' style='background-image:url(${obj.skulist[1].img});'></div>
					<ul class="casedetail-per">
						<li class="caselist-name">${obj.PatientName}</li>
						<li   class='casedetail-pro'>
							<div>所做项目:</div>
							<div class="casedetail-protxt">${obj.Operation}</div>
						</li>
		
					</ul>
				
					`)
//									<ul class="casedetail-msg">
//						<li>主治医生:${obj.DocName}</li>
//					</ul>
				html=''
				var casedt=obj.skulist
				$.each(casedt, function(i,item) {
					//天数
					dayHtml=''
					item.Days===0?dayHtml=`手术前照片`:dayHtml=`手术后${item.Days}天的效果图`
					//图片
					imgHtml=''
					var imgs=item.img
					$.each(imgs,function(i,img) {
						imgHtml +=`<li class='opeate-img-item' style='background-image:url(${img});'></li>`
					})
					//疗程
					html += `
					<li>
						<div class="before">
							<div class="main-r-nu">${item.id}</div>
						<div class="main-r-title">${dayHtml}</div>
						</div>
						<div class="main-r-con">${item.Describe}</div>
						<ul class='opeate-img'>${imgHtml}</ul>
					</li>
					`
				});
				$('.casedetail-main-r').append(html)
 				
   			
			} else {}
		}
	});
});